package com.jali.crud.controller;

import com.jali.crud.bean.Dept;
import com.jali.crud.bean.Msg;
import com.jali.crud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author jali
 * @create 2018-12-12 10:18
 */
@Controller
public class DeptController {

    @Autowired
    DeptService deptService;

    @RequestMapping("depts")
    @ResponseBody
    public Msg getDepts(){
        List<Dept> depts = deptService.getDepts(null);
        return Msg.success().add("depts",depts);
    }
}
